<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>用户列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <style type="text/css">
          .layui-table-cell{
              height: auto!important;
              white-space: normal;
          }
  </style>

    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
                            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                              <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
                          </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                          <table class="layui-table" lay-data="{height:315, url:'https://api.lzjlw.top:3030/backstage/feedbackContent',parseData:function(res){return{'code':0,'data':res,'count':30}} ,page:true, id:'userinfo'}" lay-filter="userinfo">
                            <thead>
                              <tr>
                                <th lay-data="{field:'id', width:90,align:'center', sort: true}">ID</th>
                                <th lay-data="{field:'userId',align:'center', width:150}">用户ID</th>
                                <th lay-data="{field:'feedbackId', width:150,align:'center', sort: true}">反馈Id</th>
                                <th lay-data="{field:'feedbackContent',align:'center', width:150}">反馈内容</th>
                                <th lay-data="{field:'time',width:150,align:'center'}">反馈时间</th>
                                <th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo'}">执行操作</th>                                      
                              </tr>
                            </thead>
                          </table>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
    </body>
    <!-- 行工具栏删除按钮 -->
    <script type="text/html" id="barDemo">
      <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
      layui.use('table', function(){
        var table = layui.table;
        table.on('tool(userinfo)',function(obj){
          var data = obj.data; //获得当前行数据
          var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
          if(layEvent==='del'){
            console.log(data)
            layer.open({
              content:'确认删除该用户反馈吗？',
              btn:['确认删除','取消'],
              yes:function(index,layero){
                $.ajax({
                  type:'delete',
                  url:'https://api.lzjlw.top:3030/backstage/feedbackContent?feedbackId='+data.feedbackId,
                  success:function(res){
                    location.reload();
                  },
                  complete:function(res){
                    console.log('请求完成');
                  }
                })
              },
              btn2:function(){
                xadmin.father_reload();
              },
              cancle:function(){
                location.reload()
              }
            })
          }
        })  
      });
      </script>
</html>